//package com.gdufe.firesafe.utils;
//
//import cn.hutool.core.date.DateUtil;
//import com.auth0.jwt.JWT;
//import com.auth0.jwt.algorithms.Algorithm;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.PostConstruct;
//import java.util.Date;
//
//@Component
//public class CommonTokenUtils {
//    @Value("${jwt.secret}")
//    private String secret;
//
//    private static String staticSecret;
//
//    @PostConstruct
//    public void setSecret(){
//        staticSecret=secret;
//    }
//
//    public static final String INTERNAL = "internal";
//
//    //生成token
//    public static String createToken(){
//        return JWT.create().withAudience(INTERNAL)
//                .withExpiresAt(DateUtil.offsetMinute(new Date(),2))  //2分钟后token过期
//                .sign(Algorithm.HMAC256(staticSecret));
//    }
//
//}
